<?php 
include_once 'src/util/config.php'; 
$config = new Config();
$config->checkLogin();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8"/>
        <link rel="stylesheet" href="css/index.css" type="text/css"/>
        <link rel="stylesheet" href="css/colors.css" type="text/css"/>
        <link rel="stylesheet" href="css/tool.css" type="text/css"/>
        <link rel="stylesheet" href="css/jquery.dataTables.css" type="text/css"/>
        <link rel="stylesheet" href="css/le-frog/jquery-ui.css" type="text/css"/>
        <title> Óptica Capital :: Principal </title>
        <?php $config->iniJSDependencies(); ?>
        <?php $config->checkMessage(); ?>
    </head>
    <body>
        <div id="body" class="">		
        <?php
        if($config->isLoged()) {
        ?>
            <div id="top-menu" class="box green2-grad-back">
                <ul id="menu-top-list">
                    <li class="parent-op-top-menu">
                        <div class="span-item selectable" op="home"> <img src="images/right.ico"> Home </div>
                    </li>    
                    <li class="parent-op-top-menu">
                        <div class="span-item"> <img src="images/down.ico"> Cadastros </div>
                        <ul class="hidden sub-menu box"> 
                            <li class="list-section-header"> Selecione uma entidade </li>
                            <?php
                            $opCadList = array( 
                                "cad-clie" => "Cadastro de Clientes",
                                "cad-prod" => "Cadastro de Produtos",
                                "cad-loja" => "Cadastro de Lojas",
                                "cad-func" => "Cadastro de Funcionários",
                                "cad-regi" => "Cadastro de Regiões",
                                "cad-rota" => "Cadastro de Rotas",
                                "cad-loca" => "Cadastro de Localidades",
                                "cad-tipo" => "Cadastro de Tipos de Produto",
                                "cad-marc" => "Cadastro de Marcas de Produtos",
                                "cad-labo" => "Cadastro de Laboratórios"                               
                            );
                            foreach($opCadList as $op => $val_op){ ?>
                                <li op="<?php echo $op; ?>" class="sub-menu-item selectable"><?php echo $val_op;?><img src="images/right.ico"> </li>
                            <?php } ?> 
                        </ul>
                    </li>
                    <li class="parent-op-top-menu"> 
                        <div class="span-item"> <img src="images/down.ico"> Vendas </div>
                        <ul class="hidden sub-menu box"> 
                            <li class="list-section-header"> Selecione uma opção de venda </li>
                            <?php
                            $opVendList = array( 
                                "cad-orde" => "Ordem de Serviços",
                                "cad-vend" => "Cadastro de Vendas"
                            );
                            foreach($opVendList as $op => $val_op){ ?>
                                <li op="<?php echo $op; ?>" class="sub-menu-item selectable"><?php echo $val_op;?><img src="images/right.ico"> </li>
                            <?php } ?> 
                        </ul>
                    </li>
                    <li class="parent-op-top-menu"> 
                        <div class="span-item selectable" op=""> <img src="images/right.ico"> Relatórios </div>
                    </li>
                    <li class="parent-op-top-menu"> 
                        <div class="span-item selectable" op=""> <img src="images/right.ico"> Cobrança </div> 
                    </li>
                </ul>
                <img id="logo" src="images/logo.jpg" />
                <div id="welcome-space">
                    <stron> Bem vindo <b><?php echo $_SESSION[SESSION_NOME_FUNC]?></b></span>
                    <div class="selectable btn" op="logout" id="logout-btn"> Sair do Sistema </div>
                </div>
            </div>
            <div id="content" class="box green-grad-back"> 
                <?php $config->contentController();?>
            </div>
        </div>
        <div id="view-data-back" class="hidden">
            <a href="javascript:void(0)" onclick="closeViewDataMode()" class="close-data-view"> X </a>
            <div class="content"> 
            </div>
        </div>
    <?php } else { 
            include_once LOGIN_FORM;
         } ?>
        <div id="alert" class="hidden">
            <div id="content-alert"> </div>
            <div id="close-alert" class="gray-grad-back" onclick="closeAlert()"> Fechar </div>
        </div>
    </body>
    
    <script src="script/jquery.js"></script>
    <?php if($config->isLoged()) {?>
    <script src="script/jquery-ui.js"></script>
    <script src="script/datatable.js"></script>
    <?php } ?>
    <script src="script/index.js"></script>
    <script src="script/tool.js"></script>
    <?php $config->execJSDependencies(); ?>
</html>
